import Data.List
import Data.Ord

collatz :: Int -> [Int]
collatz 1 = [1]
collatz n = n : collatz nextCollatz
	where 
	nextCollatz = if even n 
		then n `div` 2 
		else 3*n + 1

euler_014 = maximumBy (comparing snd) $ map (\x -> (x,(length . collatz) x)) [1..1000000]